package com.briup.srms.exam.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.briup.srms.exam.bean.extend.StudentExamExtend;
import com.briup.srms.exam.dao.StudentExamMapper;
import com.briup.srms.exam.dao.extend.StudentExamExtendMapper;
import com.briup.srms.exam.service.IStudentExamService;
import com.jacky.base.utils.CustomerException;
import com.jacky.base.utils.PageVM;

@Service
public class StudentExamServiceImpl implements IStudentExamService {

    @Resource
    private StudentExamExtendMapper studentExamExtendMapper;
    @Resource
    private StudentExamMapper studentExamMapper;

    @Override
    public PageVM<StudentExamExtend> query(int page, int pageSize, String status, Long studentId, Long examId, Long clazzId) {
        List<StudentExamExtend> list = studentExamExtendMapper.select(page, pageSize, status, studentId, examId, clazzId);
        long total = studentExamExtendMapper.count(status, studentId, examId, clazzId);
        return new PageVM<>(page, pageSize, total, list);
    }

    @Override
    public void deleteById(long id) throws CustomerException {
        studentExamMapper.deleteByPrimaryKey(id);
    }

    @Override
    public StudentExamExtend queryById(long id) {
        return studentExamExtendMapper.selectById(id);
    }

}
